### Ensemble Averaging and Merging


## Task 2



## s-2
Pred.Ensemble.Task2.s2.africa <- read.csv("Pred_Ensemble_Task2_s2_africa.csv", header=TRUE)


Pred.Ensemble.Task2.s2.africa[, c(5,6,7,1,2,3,4,9,10,11)] -> Ensemble.Eval.T2.s2

Ensemble.Eval.T2.s2$RF.GED.t2.s2 - Ensemble.Eval.T2.s2$real -> Ensemble.Eval.T2.s2$RF.GED.t2.s2.diff
Ensemble.Eval.T2.s2$XGB.GED.t2.s2 - Ensemble.Eval.T2.s2$real -> Ensemble.Eval.T2.s2$XGB.GED.t2.s2.diff

Ensemble.Eval.T2.s2$RF.United.t2.s2 - Ensemble.Eval.T2.s2$real -> Ensemble.Eval.T2.s2$RF.United.t2.s2.diff
Ensemble.Eval.T2.s2$XGB.United.t2.s2 - Ensemble.Eval.T2.s2$real -> Ensemble.Eval.T2.s2$XGB.United.t2.s2.diff

Ensemble.Eval.T2.s2$RF.GED.t2.s2.africa - Ensemble.Eval.T2.s2$real -> Ensemble.Eval.T2.s2$RF.GED.t2.s2.africa.diff
Ensemble.Eval.T2.s2$XGB.GED.t2.s2.africa - Ensemble.Eval.T2.s2$real -> Ensemble.Eval.T2.s2$XGB.GED.t2.s2.africa.diff

### included test
Ensemble.Eval.T2.s2$unw.ensemble <- rowMeans(Ensemble.Eval.T2.s2[,4:9])
MSE(Ensemble.Eval.T2.s2$unw.ensemble, Ensemble.Eval.T2.s2$real)
### yes, no problem


 
write.csv(Ensemble.Eval.T2.s2, file="Ensemble_Eval_t2_s2.csv", row.names = FALSE)




## s-7
Pred.Ensemble.Task2.s7.africa <- read.csv("Pred_Ensemble_Task2_s7_africa.csv", header=TRUE)


Pred.Ensemble.Task2.s7.africa[, c(3,4,5,1,2,6,7,10,11)] -> Ensemble.Eval.T2.s7
Pred.Ensemble.Task2.s7.africa$ln_ged_best_sb_s7 -> Ensemble.Eval.T2.s7$real


Ensemble.Eval.T2.s7$RF.GED.t2.s7 - Ensemble.Eval.T2.s7$real -> Ensemble.Eval.T2.s7$RF.GED.t2.s7.diff
Ensemble.Eval.T2.s7$XGB.GED.t2.s7 - Ensemble.Eval.T2.s7$real -> Ensemble.Eval.T2.s7$XGB.GED.t2.s7.diff

Ensemble.Eval.T2.s7$RF.United.t2.s7 - Ensemble.Eval.T2.s7$real -> Ensemble.Eval.T2.s7$RF.United.t2.s7.diff
Ensemble.Eval.T2.s7$XGB.United.t2.s7 - Ensemble.Eval.T2.s7$real -> Ensemble.Eval.T2.s7$XGB.United.t2.s7.diff

Ensemble.Eval.T2.s7$RF.GED.t2.s7.africa - Ensemble.Eval.T2.s7$real -> Ensemble.Eval.T2.s7$RF.GED.t2.s7.africa.diff
Ensemble.Eval.T2.s7$XGB.GED.t2.s7.africa - Ensemble.Eval.T2.s7$real -> Ensemble.Eval.T2.s7$XGB.GED.t2.s7.africa.diff



write.csv(Ensemble.Eval.T2.s2, file="Ensemble_Eval_t2_s2.csv", row.names = FALSE)
write.csv(Ensemble.Eval.T2.s7, file="Ensemble_Eval_t2_s7.csv", row.names = FALSE)








